<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>array</title>
</head>
<body>
    <!-- 数组, JS 的数组事弱类型 -->
    <script>
        var blankArray = [];
        var numArray = [0, 1, 2, 3];
        var commaArray = [,,,];
        var complexArray = [0, 'abc', undefined, null, true, {}];
        // 如何访问数组元素
        console.log(numArray[1]);
        console.log(complexArray[3]);

        // 数组赋值
        // 如果一个下标位置原来不存在，会添加，还会添加length
        blankArray[3] = 5;
        console.log(blankArray);
        // 如果下表存在，覆盖
        numArray[2] = 4;
        console.log(numArray);
        // 数组有长度 length
        console.log(blankArray.length);
        
        // 使用构造函数方式生成数组
        
    </script>
</body>
</html>